<?php
/* @var $this ProductController */
/* @var $model Product */
/* @var $form CActiveForm */
?>

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'product-form',
	'enableAjaxValidation'=>false,
	'htmlOptions' => array(
    	'enctype' => 'multipart/form-data'
     )
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'product_category_id'); ?>
		<?php echo $form->dropDownList($model, 'product_category_id', CHtml::listData(ProductCategory::model()->findAllByAttributes(array('status' => 1, 'parent_id' => '!0')), 'id', 'title')); ?>
		<?php echo $form->error($model,'product_category_id'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'title'); ?>
		<?php echo $form->textField($model,'title',array('size'=>60,'maxlength'=>200)); ?>
		<?php echo $form->error($model,'title'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'thumbnail'); ?>
		<?php echo $form->fileField($model,'thumbnail'); ?>
		<?php echo $form->error($model,'thumbnail'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($imagesModel,'images'); ?>
		<?php  $this->widget('CMultiFileUpload',
		  array(
		       'model' => $imagesModel,
		       'attribute' => 'uri',
		       'accept' => 'jpg|jpeg|png',
		       'denied' => 'Only jpg,jpeg,png are allowed',
		       'max'=> 5,
		       'remove' => '[Remove this image]',
		       'duplicate' => 'Already Selected',

		       )
		        );?>
		<?php echo $form->error($imagesModel,'uri'); ?>
		<div class="hint">You can upload up to four images.</div>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'quote'); ?>
		<?php echo $form->textArea($model,'quote',array('rows'=>6, 'cols'=>50)); ?>
		<?php echo $form->error($model,'quote'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'content'); ?>
		<?php echo $form->textArea($model,'content',array('rows'=>6, 'cols'=>50, 'id' => 'main-content')); ?>
		<?php $this->widget('ext.ckeditor.CKEditor', array('selector' => 'main-content'));?>
		<?php echo $form->error($model,'content'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'status'); ?>
		<?php echo $form->dropDownList($model,'status', array(0 => Yii::t('app', 'unPublic'), 1 => Yii::t('app', 'public'))); ?>
		<?php echo $form->error($model,'status'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'is_feature'); ?>
		<?php echo $form->dropDownList($model,'is_feature', array(0 => Yii::t('app', 'no'), 1 => Yii::t('app', 'yes'))); ?>
		<?php echo $form->error($model,'is_feature'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'sorter_category'); ?>
		<?php echo $form->textField($model,'sorter_category'); ?>
		<?php echo $form->error($model,'sorter_category'); ?>
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->